<template>
  <div class="myPagination">
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page="pagination.currentPage"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pagination.pageSize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="pagination.total">
    </el-pagination>
  </div>
</template>

<script>
export default {
  name: 'myPagination',
  props: {
    pagination: {
      type: Object,
      default: null
    }
  },
  data () {
    return {
    }
  },
  methods: {
    // 页面大小改变时会触发
    handleSizeChange (pageSize) {
      this.$emit('handleSizeChange', pageSize)
    },
    // 当前页改变时会触发
    handleCurrentChange (currentPage) {
      this.$emit('handleCurrentChange', currentPage)
    }
  }
}
</script>

<style>
.myPagination{
  float: left;
}
</style>
